#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

const int N = 1e5+50;

int n, x;
int a[N];
LL s[N];


int main(int argc, char const *argv[])
{
	int t;
	scanf("%d", &t);
	for (int kk=0; kk<t; ++kk) {
		scanf("%d%d", &n, &x);
		for (int i=0; i<n; ++i)
			scanf("%d", &a[i]);
		sort(a, a+n);
		reverse(a, a+n);
		s[0] = a[0];
		for (int i=1; i<n; ++i)
			s[i] = s[i-1] + a[i];

		if (a[0] < x) {
			puts("0");
			continue;
		} else {
			int l = 1, r = n + 1;
			while (l < r-1) {
				int m = (l+r) >> 1;
				LL vals = 1LL * m * x;
				if (vals <= s[m-1])
					l = m;
				else
					r = m;
			}
			printf("%d\n", l);
		}
	}
    return 0;
}

